from sklearn.preprocessing import MinMaxScaler,StandardScaler

def minmax():
    """
    归一化
    如果数据中有异常值,就会影响很大,鲁棒性较差,只适合传统精确小数据场景
    :return:
    """
    data = [
        [100, 200, 10],
        [150, 600, 15],
        [200, 400, 60]
    ]
    transfer = MinMaxScaler()
    data_new = transfer.fit_transform(data)
    print(data_new)
def standard():
    """
    标准化,得到的值在0附近
    在已有样本足够多的情况下比较稳定,社会现代嘈杂的大数据场景
    :return:
    """
    data = [
        [100, 200, 10],
        [150, 600, 15],
        [200, 400, 60]
    ]
    transfer = StandardScaler()
    data_new = transfer.fit_transform(data)
    print(data_new)
if __name__ == '__main__':
    standard()
